/*
 * claplan_data.cpp
 *
 *  Created on: 1 Nov 2013
 *      Author: Tom Vercauteren
 */

#include "claplan_data.h"
#include "claplan_print.h"

using std::endl;

ClaplanData::ClaplanData() :
		file(""), nfrac(0)
{

}

ClaplanData::~ClaplanData()
{

}

ClaplanData::ClaplanData(const ClaplanData &cd)
{
	if (this != &cd) *this = cd;
}

ClaplanData& ClaplanData::operator=(const ClaplanData &cd)
{
	if (this != &cd)
	{
		file = cd.file;
		header = cd.header;
		opt = cd.opt;
		nfrac = cd.nfrac;
		targets = cd.targets;
		oars = cd.oars;
		beams = cd.beams;
	}
	return *this;
}

std::ostream & operator<<(std::ostream & os, const ClaplanData &data)
{
	print_class_solution_header(os);
	print_comment_block(os, "Header");
	os << data.header << endl;
	print_comment_block(os, "Optimization parameters");
	os << data.opt << endl;
	print_comment_block(os, "Fractionation");
	print_kv<string, double>(os, "nfrac", data.nfrac);
	os << endl;
	print_comment_block(os, "Targets");
	for (unsigned i = 0; i < data.targets.size(); i++)
		os << data.targets.at(i) << endl;
	os << endl;
	print_comment_block(os, "Organs at risk (OARs)");
	for (unsigned i = 0; i < data.oars.size(); i++)
		os << data.oars.at(i) << endl;
	print_comment_block(os, "Beams");
	for (unsigned i = 0; i < data.beams.size(); i++)
		os << data.beams.at(i) << endl;
	os << endl;
	return os << endl;
}
